% construct diffusion and random force part
function rest = randomforce(t,y,R,sig)

load('indexJNKR');
load('msval');

row=size(JNKR,1); colum=size(JNKR,2);
if row >=2
    rest(row)=0;
end
dt1=1/100; 
dt2=1/10000;
t2courseindex=floor((t+0.5*dt1)/dt1)+1;
t2fineindex  =floor((t+0.5*dt2)/dt2)+1;
rest(1)=-1/2*sig(t2fineindex).^2;

rest(sum(JNKR,2)==1)=rest(sum(JNKR,2)==1)+sig(t2fineindex)*msval(t2courseindex,colum:-1:1);

rest=rest';




